let eventEmitter = require( '../../eventEmitter' );

// 通过 socket.io 向客户端发送一
// 触发新订单事件
// 该事件会造成 socket.io 向各个客户端发送新订单事件
informClient = ( event, data ) => {
    return new Promise( ( resolve, reject ) => {
      if ( typeof event !== 'string' ) reject( '事件类型错误' );
      let time = new Date();
      eventEmitter.emit( event, Object.assign( {}, data, { time } ));
      resolve();

    } ).catch( err => console.error( err ) );

};






module.exports = informClient;